package exception;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 *
 */
public class FinallyDemo2 {
    public static void main(String[] args) {
        FileOutputStream fos = null;
        try {
            fos = new FileOutputStream("./src/main/java/exception/finallyDemo2.txt");
            fos.write(2);
            fos.close();
        } catch (IOException e) {
            System.out.println("出错了，并解决了");;
        } finally {
            try{
                if(fos != null){
                    fos.close();
                }
            }catch (IOException e){
                System.out.println("关闭流时出错了");
            }
        }
        // 聊天室
    }
}
